$(function(){
	var bg_height = $(window).height();//获取浏览器可视区域的高度
	var bg_width = $(window).width();//获取浏览器可视区域的高度
	$('body').css('min-width',bg_width);
	/*首页_begin------------------------------------------------------------------*/
	
	//轮播图
	var flv_img_cnt = $('.imgshow_div .out_box .center_div .img_ul .img_li').length;//获取图片个数	
	$('.imgshow_div .out_box .center_div .img_ul').css('width',flv_img_cnt*425+'px');//设定容器宽度
	$('.imgshow_div .out_box .center_div .point_ul').css('width',flv_img_cnt*42+'px');//设定容器宽度

	/*广告图片轮换_begin*/
	var index_lunhuan = 0;
	var oFlv_img=$('.imgshow_div .out_box .center_div .img_ul .img_li img').eq(index_lunhuan);
		oFlv_img.css('margin-left',(425-oFlv_img.width())/2+'px');
		oFlv_img.css('margin-top',(370-oFlv_img.height())/2+'px');
	function flv_attr(){
		for (i=0;i<flv_img_cnt;i++){
			oFlv_img = $('.imgshow_div .out_box .center_div .img_ul .img_li img').eq(i);
			oFlv_img.css('margin-left',(425-oFlv_img.width())/2+'px');
			oFlv_img.css('margin-top',(370-oFlv_img.height())/2+'px');
		}
	}
	function index_lunhuan_fn(){
		index_lunhuan++;
		flv_attr();
		index_lunhuan = (index_lunhuan == flv_img_cnt)?0:index_lunhuan;
		var flv_img_left = -425*index_lunhuan;
		$('.imgshow_div .out_box .center_div .img_ul').stop().animate({'left':flv_img_left+'px'},500);
		$('.imgshow_div .out_box .center_div .point_li div').eq(index_lunhuan).addClass('cur');
		$('.imgshow_div .out_box .center_div .point_li').eq(index_lunhuan).siblings('li').children('div').removeClass('cur');
	}
	var index_timer = setInterval(index_lunhuan_fn,4000);
	$('.imgshow_div .out_box .center_div .img_ul .img_li img').hover(function(){
		clearInterval(index_timer);//鼠标悬停图片上停止滚动
	},function(){
		 index_timer = setInterval(index_lunhuan_fn,4000);//鼠标离开重新执行动画
	})
	$('.imgshow_div .out_box .center_div .point_li').click(function(){
		clearInterval(index_timer);
		index_lunhuan = $(this).index();
		flv_attr();				
		var flv_img_left = -425*index_lunhuan;
		$('.imgshow_div .out_box .center_div .img_ul').stop().animate({'left':flv_img_left+'px'},500);
		$('.imgshow_div .out_box .center_div .point_li div').eq(index_lunhuan).addClass('cur');
		$('.imgshow_div .out_box .center_div .point_li').eq(index_lunhuan).siblings('li').children('div').removeClass('cur');
		index_timer = setInterval(index_lunhuan_fn,4000);
	})
	$('.imgshow_div .out_box .left_btn img').click(function(){
		clearInterval(index_timer);
		index_lunhuan--;
		flv_attr();
		index_lunhuan = (index_lunhuan == -1)?(flv_img_cnt-1):index_lunhuan;
		var flv_img_left = -425*index_lunhuan;
		$('.imgshow_div .out_box .center_div .img_ul').stop().animate({'left':flv_img_left+'px'},500);
		$('.imgshow_div .out_box .center_div .point_li div').eq(index_lunhuan).addClass('cur');
		$('.imgshow_div .out_box .center_div .point_li').eq(index_lunhuan).siblings('li').children('div').removeClass('cur');
		index_timer = setInterval(index_lunhuan_fn,4000);
	})
	$('.imgshow_div .out_box .right_btn img').click(function(){
		clearInterval(index_timer);
		index_lunhuan++;
		flv_attr();
		index_lunhuan = (index_lunhuan == flv_img_cnt)?0:index_lunhuan;
		var flv_img_left = -425*index_lunhuan;
		$('.imgshow_div .out_box .center_div .img_ul').stop().animate({'left':flv_img_left+'px'},500);
		$('.imgshow_div .out_box .center_div .point_li div').eq(index_lunhuan).addClass('cur');
		$('.imgshow_div .out_box .center_div .point_li').eq(index_lunhuan).siblings('li').children('div').removeClass('cur');
		index_timer = setInterval(index_lunhuan_fn,4000);
	})
	/*广告图片轮换_end*/

	// 内容区域DIV属性值计算
	var index_cont_right_width = $('.index_cont_left .cont_left_box .center .cont_box').width() - 85;
	$('.index_cont_left .cont_left_box .center .cont_box .right').css('width',index_cont_right_width);

	/*tab切换-begin*/
	$('.index_sec_box h2 div').click(function(){
		var oIndexClass = $(this).attr('class');
		if(oIndexClass == 'download'){
			$(this).attr('class','download_cur');
			$(this).siblings('div').attr('class','news');
			$('.index_sec_box .cont_download').show();
			$('.index_sec_box .cont_news').hide();

		}else if(oIndexClass == 'news'){
			$(this).attr('class','news_cur');
			$(this).siblings('div').attr('class','download');
			$('.index_sec_box .cont_news').show();
			$('.index_sec_box .cont_download').hide();
		}else{
			return;
		}
	})
	/*tab切换-begin*/

	/*首页_end------------------------------------------------------------------*/

	/*下载页_end------------------------------------------------------------------*/
	//计算.download_cpzl .center宽度
      download();
	/*下载页_end------------------------------------------------------------------*/

	/*最新消息_资料下载_begin-------------------------------------------*/
	
	var nd_cont_right_width = $('.nd_cont_box').width() - $('.nd_cont_box .left').width()-3;
	$('.nd_cont_box .right').css('width',nd_cont_right_width+'px');
	$('#nd_news_box .cont').last().css('border-bottom','1px solid #dedede');
	$('#nd_download_box .cont').last().css('border-bottom','1px solid #dedede');
	
	$('#ndNewMessage').click(function(){
		$(this).attr('class','title_li_cur');
		$('#ndResouce').attr('class','title_li');
		$('#nd_news_box').show();
		$('#nd_download_box').hide();
	})
	$('#ndResouce').click(function(){
		$(this).attr('class','title_li_cur');
		$('#ndNewMessage').attr('class','title_li');
		$('#nd_download_box').show();
		$('#nd_news_box').hide();
	})
	/*最新消息_资料下载_end-------------------------------------------*/
 
	/*关于页面_begin--------------------------------------------------*/
	var about_box_right_w = $('.container').width() - $('.about_box .left').width()-15;
	$('.about_box .right').css('width',about_box_right_w+'px');
	//$('.about_box .right img').css('margin-left',(about_box_right_w - $('.about_box .right img').width())/2+'px');
	$('.about_box .right img').css('margin-top','30px');
	/*关于页面_end--------------------------------------------------*/

	/*资料内页_begin--------------------------------------------------*/
	var article_box_w = $('.about_box .article_box').width();
//	$('.about_box .article_box img').css('margin-left',(article_box_w - $('.about_box .article_box img').width())/2+'px');
	
	/*资料内页_end--------------------------------------------------*/

})



function download(){
	var cpzl_width = $('.download_cpzl').width() - 98;
	$('.download_cpzl .center').width(cpzl_width+'px');//设置center_div宽度
	var cpzl_img_cnt = $('.download_cpzl .center .center_li').length;//获取产品种类图片个数
	var cpzl_li_width = cpzl_width*0.25;
	$('.download_cpzl .center .center_li').width(cpzl_li_width+'px');//设置每个li宽度
	$('.download_cpzl .center .center_ul').css('width',(cpzl_img_cnt*cpzl_li_width)+'px');//设定容器宽度
	if(cpzl_img_cnt <=4){
		$('.download_cpzl .left').html('');
		$('.download_cpzl .right').html('');
	}else{
		var cpzl_img_index = 0;
		$('.download_cpzl .right img').click(function(){
			cpzl_img_index++;
			if(cpzl_img_index > cpzl_img_cnt - 4){
				cpzl_img_index = cpzl_img_cnt-4;
				// alert('已经是最后一张图片');
				return false;
			}else{
				var cpzl_img_left = -cpzl_li_width*cpzl_img_index;//获取DIV框left值
				$('.download_cpzl .center .center_ul').stop().animate({'left':cpzl_img_left+'px'},400);
			}			
		})
		$('.download_cpzl .left img').click(function(){
			cpzl_img_index--;
			if(cpzl_img_index < 0){
				cpzl_img_index = 0;
				// alert('已经是第一张图片');
				return false;
			}else{
				var cpzl_img_left = -cpzl_li_width*cpzl_img_index;//获取DIV框left值
				$('.download_cpzl .center .center_ul').stop().animate({'left':cpzl_img_left+'px'},400);
			}			
		})
	}
}